package org.yzh.web.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yzh.web.mapper.DeviceMapper;
import org.yzh.web.model.entity.Device;
import org.yzh.web.service.IDeviceService;

import java.util.List;

@Service
public class DeviceServiceImpl implements IDeviceService {

    @Autowired
    private DeviceMapper deviceMapper;

    @Override
    public Device getDeviceById(String id) {
        return deviceMapper.getDeviceById(id);
    }

    @Override
    public List<Device> queryDeviceList(Device device) {
        return deviceMapper.selectDeviceList(device);
    }

    @Override
    public boolean addDevice(Device device) {
        return deviceMapper.insertDevice(device) > 0;
    }

    @Override
    public boolean editDevice(Device device) {
        return deviceMapper.updateDevice(device) > 0;
    }

    @Override
    public boolean deleteDeviceById(String id) {
        return deviceMapper.deleteDeviceById(id) > 0;
    }

    @Override
    public boolean deleteDeviceByIds(String[] ids) {
        return deviceMapper.deleteDeviceByIds(ids) > 0;
    }
}
